home *** CD-ROM | disk | FTP | other *** search
/ Net Connect / NetConnect - Version 1.iso / amitcp / install amitcp < prev    next >
Text File  |  1996-12-01  |  28KB  |  904 lines

  1. ;;;; Hey Emacs, this script might as well be -*- lisp -*-
  2. ;;;;
  3. ;;;; Install AmiTCP - AmiTCP/IP installation script for Installer
  4. ;;;;
  5. ;;;; Copyright © 1996 AmiTCP/IP Group,
  6. ;;;;                  NSDi - Network Solutions Development Inc., Finland
  7. ;;;;                  All rights reserved.
  8. ;;;;
  9. ;;;; $Id: Install\040AmiTCP,v 4.5 1996/12/01 17:13:30 too Exp $
  10. ;;;;
  11. ;;;; This script has been tested with Installer.
  12. ;;;;
  13. ;;;;     Installer and Installer project icon
  14. ;;;;     (c) Copyright 1991-93 Commodore-Amiga, Inc.  All Rights Reserved.
  15. ;;;;     Reproduced and distributed under license from Commodore.
  16. ;;;;
  17. ;;;;     INSTALLER SOFTWARE IS PROVIDED "AS-IS" AND SUBJECT TO CHANGE;
  18. ;;;;     NO WARRANTIES ARE MADE.  ALL USE IS AT YOUR OWN RISK.  NO LIABILITY
  19. ;;;;     OR RESPONSIBILITY IS ASSUMED.
  20. ;;;;
  21. ;;;; Use following Icon tooltypes / Command line options:
  22. ;;;; APPNAME=AmiTCP/IP
  23. ;;;; MINUSER=AVERAGE
  24. ;;;;
  25. ;;;;
  26. ;;;; What we are?
  27. ;;;;
  28. (set app-name (cat @app-name " DialUp 4.5"))
  29. (set app-dir-name (cat "AmiTCP-DialUp-4.5"))
  30.  
  31. (welcome "    Welcome to the " app-name " installation.\n")
  32.  
  33. (if (= @pretend 1)
  34.     (set pretend-extra "\nNote: `Make New Drawer' will make new drawer even in PRETEND mode")
  35. (set pretend-extra ""))
  36.  
  37. (set
  38. ;;;;
  39. ;;;; "Needs"
  40. ;;;;
  41.  need-version 37  ; version of operating system need by AmiTCP/IP
  42.  need-memory (* 512 1024)
  43.  
  44.  AmiTCP-release-number 4 ; this release
  45. ;;;
  46. ;;; Installation disk names
  47. ;;;
  48.  install-disk1-name "AmiTCP-DialUp-4.5:"
  49. ;;;
  50. ;;; Used pkt-files, source-dir will remain on the disk from which the 
  51. ;;; installer was started!
  52. ;;;
  53.  AmiTCP-pkt-file (tackon install-disk1-name "AmiTCP.pkt")
  54.  Docs-pkt-file (tackon install-disk1-name "AmiTCPDocs.pkt")
  55.  NapsaFonts-pkt-file (tackon install-disk1-name "NapsaFonts.pkt")
  56. ;;;
  57. ;;; Other sources on installation disks
  58. ;;;
  59.  dist-networks-dir (tackon install-disk1-name "Devs/Networks")
  60.  dist-providers-dir (tackon install-disk1-name "providers")
  61.  Installer-file (tackon install-disk1-name "Installer")
  62.  UnPkt-file (tackon install-disk1-name "UnPkt")
  63.  LICENSE-file (tackon install-disk1-name "LICENSE")
  64.  README-FIRST-file (tackon install-disk1-name "Read Me First")
  65.  info.AmiTCPdir-file (tackon install-disk1-name "info.AmiTCPdir")
  66.  
  67. ;;;
  68. ;;; Destination directories of the AmiTCP/IP
  69. ;;;
  70.  atcp-name "AmiTCP"
  71.  atcp-assign (cat atcp-name ":")    ; Assign to AmiTCP
  72.  ;; Configuration
  73.  conf-dir (tackon atcp-assign "db")
  74.  ;; User binaries
  75.  bin-dir (tackon atcp-assign "bin")
  76.  ;; documentation
  77.  doc-dir (tackon atcp-assign "doc")
  78.  ;; devices directory
  79.  devs-dir (tackon atcp-assign "devs")
  80.  ;; DOS handlers
  81.  l-dir (tackon atcp-assign "l")
  82.  ;; libraries
  83.  libs-dir (tackon atcp-assign "libs")
  84.  ;; providers 
  85.  prov-dir (tackon atcp-assign "providers")
  86.  ;; dialup scrips
  87.  ssrx-dir (tackon atcp-assign "ssrx")
  88.  
  89.  ;;
  90.  ;; The source directory name
  91.  source-dir (if (= 1 (exists @icon))
  92.         (pathonly (expandpath @icon))
  93.           (expandpath @icon))
  94.  ;; Mounts
  95.  apipe-mount (cat 
  96.           "Assign APIPE: Exists > NIL:\n" 
  97.           "IF Warn\n"
  98.           "  Mount APIPE: from AmiTCP:devs/APipe-Mountlist\n"
  99.           "EndIf\n")
  100.  )
  101. ;; How to get needed information?
  102. (set
  103.  net-setup-help
  104.  "    You can get this information from your network administration.\n")
  105.  
  106. ;;; copy "more" to ram: to be able to use it
  107. (set
  108.  pager-cmd 
  109.  (if (exists "SYS:Utilities/More" (noreq))
  110.      ((copyfiles
  111.        (prompt "Copying sys:utilities/more to ram: for use")
  112.        (source "SYS:Utilities/More")
  113.        (dest   "RAM:")
  114.        (safe)
  115.        (optional "nofail"))
  116.       "RAM:More")
  117.    ("more"))
  118.  )
  119.  
  120. ;; Return old AmiTCP: assign if we are aborting
  121. (onerror
  122.  (if old-atcp-directory
  123.      (makeassign atcp-name old-atcp-directory)))
  124.  
  125. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  126. (procedure
  127.  check-system-version
  128.  ;; is your Exec recent enough?
  129.  (set exec-version (/ (getversion) 65536))
  130.  (transcript "Running on exec version " exec-version ".")
  131.  (if (< exec-version need-version)    ; check operating system version
  132.      ((transcript "Installation aborted due too old operating system.")
  133.       (abort "AmiTCP/IP requires at least operating system 2.04"))))
  134.  
  135.  
  136. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  137. (procedure
  138.  check-available-memory
  139.  ;;
  140.  (transcript "Checking available memory.")
  141.  (set avail-mem (+ (database "total-mem")))
  142.  (if (< avail-mem need-memory)
  143.      ((message "Your system has only " (/ avail-mem 1024) " kilobytes of "
  144.            "free memory, while the " @app-name " needs at least "
  145.            (/ need-memory 1024) " to be useful.\n"
  146.            "You can continue the installation but be warned!")
  147.       (transcript "User decided to continue installation while available "
  148.           "memory was below the recommended minimum."))))
  149.  
  150. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  151. (procedure
  152.  check-user-level
  153.  ;;
  154.  (transcript "Checking user level.")
  155.  (if (< @user-level 1)
  156.      ((transcript "Installation aborted due to too low user level.")
  157.       (abort "AmiTCP/IP installation requires at least the \"average\" "
  158.          "user level. Restart installation and select appropriate user "
  159.          "level."))))
  160.  
  161. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  162. (procedure
  163.  check-old-assign
  164.  ;; If there is already the AmiTCP/IP installed, store the assign
  165.  ;; to old-atcp-directory
  166.  (transcript "Checking for already installed AmiTCP.")
  167.  (set old-atcp-directory 
  168.       (if (exists atcp-assign (noreq))
  169.       (getassign atcp-name)
  170.     ""))
  171.  (if old-atcp-directory
  172.      (transcript "Existing AmiTCP detected at directory " 
  173.          old-atcp-directory ".")))
  174.  
  175. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  176.  
  177. (procedure
  178.  check-cpu-type
  179.  (set cpu-type (database "cpu"))
  180.  (set cpu-is-020-or-better
  181.       (AND (<> cpu-type "68000")
  182.        (<> cpu-type "68010")))
  183.  )
  184.  
  185. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  186. (procedure
  187.  ask-accept-license ;; Ask if the user accepts license conditions
  188.  (transcript "Asking if the user accepts the license conditions.")
  189. ;;
  190. ;; use "more" to show the full license text
  191. ;;
  192.  (run (cat "run " pager-cmd) LICENSE-file (safe))
  193.  (message "\nAmiTCP/IP is a copyrighted propiertary software of "
  194.       "\"Network Solutions Development Inc.\"\n"
  195.           "\nPlease read the shown license text carefully.\n"
  196.           "\nBy proceeding the installation of this software you "
  197.       "indicate that you accept the license conditions.\n\n"
  198.       "Also note that you should fill in your registration card "
  199.       "and post it.\n"
  200.       )
  201.  )
  202.  
  203. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  204. (procedure
  205.  select-destination-directory
  206.  ;; Select destination directory for the installation.
  207.  ;; This is the floppy install-version
  208.  ;;
  209.  (transcript "Selecting destination directory for the installation.")
  210.  (set atcp-dest
  211.       (askdir
  212.        (prompt "Select directory where to install\nthe " app-name "."
  213.            pretend-extra)
  214.        (help "    Here you can specify location where to install "
  215.          "the " app-name ".\n"
  216.          "    Installation must NOT be made on top of an older "
  217.          "version of the " @app-name ".\n"
  218.          "  Installer will create a subdirectory called `"
  219.          app-dir-name "' to the selected directory and copy the " 
  220.          @app-name " files to it.")
  221.        (newpath)
  222.        (default 
  223.      (if (= 2 (exists "Work:" (noreq)))
  224.          "Work:" 
  225.        (cat (getdevice "SYS:") ":")))
  226.        ))
  227.  (textfile (dest (tackon atcp-dest (cat app-dir-name ".info")))
  228.        (include info.AmiTCPdir-file))
  229.  (set atcp-dest (tackon atcp-dest app-dir-name))
  230.  (if (= pretend 0) (set @default-dest atcp-dest))
  231.  (makedir atcp-dest (infos))
  232.  (message app-name " will be installed in:\n\n" atcp-dest)
  233.  
  234.  ;; Make the AmiTCP: assign
  235.  (if (= @pretend 0)
  236.      ((makeassign atcp-name atcp-dest)
  237.       (if (NOT (= 2 (exists (tackon atcp-assign "devs"))))
  238.       (makedir (tackon atcp-assign "devs")))))
  239. )
  240.  
  241. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  242. ;;
  243. ;; This is floppy-install version
  244. ;;
  245. ;; arguments:
  246. ;;
  247. ;;   unpkt-source      - the source archive
  248. ;;   unpkt-destination - the destination directory
  249. ;;   unpkt-sdp         - number of directories to strip
  250. ;;   unpkt-title-name  - descriptive name of the archive
  251. ;;   unpkt-title-not   - installation unit name
  252.  
  253.  
  254. (procedure
  255.  run-unpkt 
  256.  ;;
  257.  (if (exists unpkt-source)
  258.      ((transcript "Dearchiving " unpkt-source " files to " unpkt-destination ".")
  259.       (working "Writing files to " unpkt-destination "...")
  260.       (if (= @pretend 0) 
  261.       ((if (run (cat unpkt-cmd " "
  262.              "\"" unpkt-source "\" "
  263.              "\"" unpkt-destination "\""
  264.              " SDP=" unpkt-sdp 
  265.              " >\"CON:9/9/600/100/UnPkt Output/INACTIVE/AUTO\" "))
  266.        (abort "    UnPkt could not dearchive the " unpkt-source ". "
  267.           "This may be due to:\n"
  268.           "    1) Not enough disk space\n"
  269.           "    2) Not enough memory\n"
  270.           "    3) Corrupted archive\n"
  271.           "    4) Corrupted UnPkt\n"))))
  272.       1)
  273.    ((transcript unpkt-source " could not be located, and is NOT installed!")
  274.     (message "\nWARNING\n\n"
  275.          "Could not locate the " unpkt-title-name " archive.\n"
  276.          unpkt-title-not " is NOT installed!")
  277.     0))
  278.  )
  279.  
  280.  
  281. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  282. ;;
  283. ;; This is floppy-install version
  284. ;;
  285. (procedure
  286.  copy-files-to-destination ;;; UnPkt AmiTCP/IP files to the destination
  287.  ;;
  288.  
  289.  (set 
  290.   unpkt-source AmiTCP-pkt-file
  291.   unpkt-destination atcp-dest
  292.   unpkt-sdp 1
  293.   unpkt-title-name "AmiTCP/IP program"
  294.   unpkt-title-not "AmiTCP/IP"
  295.   )
  296.  (if (run-unpkt)
  297.      (
  298.       ;;
  299.       ;; Copy the Installer
  300.       ;;
  301.       (copyfiles
  302.        (source Installer-file)
  303.        (dest bin-dir)
  304.        (files)
  305.        (infos))
  306.  
  307.       ;;
  308.       ;; Create AmiTCP:log if it does not exist already
  309.       ;;
  310.       (if (NOT (= 2 (exists (tackon atcp-assign "log"))))
  311.       (makedir (tackon atcp-assign "log")))
  312.       ;;
  313.       ;; Create AmiTCP:log/wtmp if it does not exist already
  314.       ;;
  315.       (if (NOT (= 1 (exists (tackon atcp-assign "log/wtmp"))))
  316.       (textfile (dest (tackon atcp-assign "log/wtmp"))))
  317.  
  318.       (copy-providers)
  319.     
  320.       ;; AmiTCP/IP program archive installed succesfully
  321.       1)
  322.    0))
  323.  
  324. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  325. (procedure
  326.  copy-providers
  327.  (transcript "Copying provider files.")
  328.  ;;
  329.  ;; Create directory AmiTCP:providers if it does not exist already
  330.  ;;
  331.  (set tmp-var (tackon atcp-assign "providers"))
  332.  (if (NOT (= 2 (exists tmp-var)))
  333.      (makedir tmp-var))
  334.  (copyfiles
  335.   (prompt "Copying provider files")
  336.   (source dist-providers-dir)
  337.   (dest tmp-var)
  338.   (all)
  339.   (optional "nofail"))
  340.  )
  341.  
  342. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  343. (procedure
  344.  update-devices
  345.   (transcript "Updating Sana-II device drivers.")
  346.  ;;
  347.  ;; Create directory DEVS:Networks if it does not exist already
  348.  ;;
  349.  (if (NOT (= 2 (exists "DEVS:Networks")))
  350.      (makedir "DEVS:Networks"))
  351.  ;;
  352.  ;; Copy each driver in the distribution to the DEVS:Networks if necessary
  353.  ;;
  354.  (working "Checking Sana-II device drivers...")
  355.  (if (= 2 (exists dist-networks-dir))
  356.      (foreach
  357.        dist-networks-dir "#?.device"
  358.        ((set dist-name (tackon dist-networks-dir @each-name)
  359.          devs-name (tackon "DEVS:Networks" @each-name)
  360.          dist-version (getversion dist-name)
  361.          copy-it (NOT (exists devs-name)))
  362.     ;;
  363.     ;; Check if the driver should be copied over
  364.     ;;
  365.     (if (NOT copy-it)
  366.         (set copy-it
  367.                  ; or if the driver in DEVS:Networks is of older version
  368.          (< (set devs-version (getversion devs-name)) dist-version)))
  369.     (if (NOT copy-it)
  370.         (set copy-it
  371.              ; or if the files are of the same version but different
  372.          (set sum-differs (if (= dist-version devs-version)
  373.                       (<> (getsum dist-name)
  374.                       (getsum devs-name))
  375.                     0))))
  376.     (if copy-it
  377.         (copyfiles
  378.          (prompt "Should this Sana-II driver be installed in Devs:Networks?\n"
  379.              (if devs-version
  380.              (cat "A driver with the same name exists already"
  381.                   (if sum-differs
  382.                   (cat ", it has the same version, but the "
  383.                        "files are not the same.")
  384.                 (cat ", but the driver in the "
  385.                      "DEVS:Networks is of older version.")))
  386.                ""))
  387.          (help
  388.           "    The Sana-II drivers should be located in "
  389.           "the DEVS:Networks directory.\n"
  390.           "    This directory is the official location for the Sana-II "
  391.           "device drivers.")
  392.          (source (pathonly dist-name))
  393.          (choices (fileonly dist-name))
  394.          (dest "DEVS:Networks")
  395.          (files)
  396.          (optional "nofail" "askuser")
  397.          (confirm "average")))))
  398.    (message "No Sana-II drivers found on the installation disk")
  399.    )
  400.  )
  401.  
  402. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  403. (procedure
  404.  ask-update-devices
  405.  (if (= 2 (exists dist-networks-dir))
  406.      (if (askbool
  407.       (prompt "\nDo you want to update your Sana-II network device "
  408.           "drivers?\n"
  409.           "Each copy will be confirmed.")
  410.           (help
  411.            "    Each new AmiTCP/IP distribution usually contains "
  412.            "updated versions of some of the provided Sana-II network "
  413.            "device drivers. If you choose \"Yes\", this installation "
  414.            "script will check for each device, if this is the case."))
  415.          (update-devices)
  416.        (transcript "User did not want to update Sana-II drivers."))
  417.    (transcript "Directory " dist-networks-dir " not found.")))
  418.  
  419. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  420. ;; 
  421. ;; arguments:
  422. ;;
  423. ;; uus::commands - commands to add
  424. ;; uus::section  - section name
  425. ;; uus::file     - file name into which to save the changes if needed
  426. ;;
  427. (procedure
  428.  update-user-startup
  429.  (set uus::complete (cat ";BEGIN " uus::section "\n"
  430.              uus::commands
  431.              ";END " uus::section "\n"))
  432.  (set startup-changed 1)
  433.  (startup
  434.   uus::section
  435.   (command uus::commands)
  436.   (prompt "Installer will modify your S:User-Startup file. "
  437.       "Following lines will be appended to it:\n\n"
  438.       uus::complete)
  439.   (help "   Installer needs to make indicated modifications to "
  440.     "your user startup file.\n"
  441.     "   You should make modifications later by hand "
  442.     "if you skip this part."))
  443.  )
  444.  
  445. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  446. (procedure
  447.  ask-copy-old-configuration
  448.  ;;
  449.  ;; Copy old configuration files
  450.  ;; Returns TRUE if AmiTCP does not need to be configured.
  451.  ;; The reconfiguration is forced now.
  452.  ;;
  453.  (set
  454.   edit-change-fingerd "t:edit-change-fingerd"
  455.   old-conf-dir (tackon old-atcp-directory "db")
  456.   old-devs-dir (tackon old-atcp-directory "devs")
  457.   old-motd (tackon old-conf-dir "motd"))
  458.  ;;
  459.  ;; return version of the old AmiTCP detected
  460.  ;;
  461.  (procedure 
  462.   get-old-atcp-version
  463.   (if (exists (tackon old-atcp-directory "AmiTCP") (noreq))
  464.       (/ (getversion (tackon old-atcp-directory "AmiTCP")) 65536)
  465.     0))
  466.  ;;
  467.  (set old-atcp-version (get-old-atcp-version))
  468.  ;;
  469.  
  470.  (procedure 
  471.   copy-rest-config
  472.   (set ask-options-bitmap 
  473.        (askoptions
  474.     (prompt
  475.      "Select configuration files you want to copy from old configuration"
  476.      "\nThe files you choose will be copied to the new configuration "
  477.      "directory when you press `Proceed'")
  478.     (help
  479.     "    You may copy your old configuration files or use untouched files "
  480.     "came with the new distribution.\nAll the files mentioned may not"
  481.     " be present in your current configuration.")
  482.  
  483.     (choices
  484.     "AmiTCP.config"
  485.     "autointerfaces"
  486.     "group"
  487.     "hosts"
  488. ; NO!    "inetd.conf"
  489.     "networks"
  490.     "resolv.conf"
  491.     "services"
  492.     "protocols"
  493.     "provider.conf"
  494.     "passwd"
  495.     "rpc"
  496.     )))
  497.  
  498.   (set n 0)
  499.   (while (set thisfile (select n
  500.                    "AmiTCP.config"
  501.                    "autointerfaces"
  502.                    "group"
  503.                    "hosts"
  504. ; NO!                   "inetd.conf"
  505.                    "networks"
  506.                    "resolv.conf"
  507.                    "services"
  508.                    "protocols"
  509.                    "provider.conf"
  510.                    "passwd"
  511.                    "rpc"
  512.                    ""))
  513.     ((if (and (in ask-options-bitmap n)
  514.          (exists (tackon old-conf-dir thisfile)))
  515.     (copyfiles
  516.      (prompt "Copying " thisfile " to " conf-dir)
  517.      (source (tackon old-conf-dir thisfile))
  518.      (dest conf-dir)
  519.      (optional "nofail" "force")))
  520.      )
  521.     (set n (+ n 1))
  522.   ))
  523.  
  524.  ;;
  525.  (procedure 
  526.   copy-motd
  527.   (if (exists old-motd)
  528.       ((if (>= @user-level 2)
  529.        (message "\nCopying file\n\n"
  530.             old-motd "\n"
  531.             "(Message Of The Day)\n"
  532.             "\nto directory \"" conf-dir "\"."))
  533.        (copyfiles
  534.     (source old-motd)
  535.     (dest conf-dir)
  536.     (files)))))
  537.  (procedure
  538.   update-services
  539.   (set service-file (tackon conf-dir "services"))
  540.   (if (run (cat "search search \"amiganetfs\" quiet from " service-file)
  541.        (safe))
  542.       (;; Not found, add it 
  543.        (textfile (dest service-file)
  544.          (include service-file)
  545.          (append ";\n; Amiga specific services\n;\n"
  546.              "amiganetfs      2500/tcp\n")
  547.          (prompt 
  548.           "Do you want to add AmigaNetFS service to your "
  549.           "service database?")
  550.          (help 
  551.           "    The " @app-name " includes NetFS, network file system "
  552.           "between Amigas, by Timo Rossi. It is a TCP based protocol "
  553.           "which requires both ends of connection have same service "
  554.           "(TCP port) entries. If you already had NetFS installed "
  555.           "you probably do not want to update your service "
  556.           "database.")
  557.          (confirm)))))
  558.  (procedure
  559.   update-hosts
  560.   (set hosts-file (tackon conf-dir "hosts"))
  561.   (if (run (cat "search search \"localhost\" quiet from " hosts-file)
  562.        (safe))
  563.       (;; Not found, add it
  564.        (transcript "Adding 'localhost' entry to the db/hosts.")
  565.        (textfile (dest hosts-file)
  566.          (include hosts-file)
  567.          (append ";\n; Entry for the localhost\n;\n"
  568.              "127.0.0.1 localhost\n")
  569.          ))))
  570.  ;;
  571.  (procedure 
  572.   update-napsaprefs
  573.   (set old-napsaprefs
  574.        (if (exists (tackon old-atcp-directory "db/NapsaPrefs") (noreq))
  575.        (tackon old-atcp-directory "db/NapsaPrefs")
  576.      (if (exists "s:NapsaPrefs")
  577.          "s:NapsaPrefs")
  578.      ""))
  579.   (if old-napsaprefs
  580.       (;;
  581.        (copyfiles 
  582.     (source old-napsaprefs)
  583.     (dest conf-dir)
  584.     (files)
  585.     (confirm)
  586.     (prompt "\nUse your old Napsaterm preferences?")
  587.     (help  "    Installer have found an existing NapsaPrefs file "
  588.            old-napsaprefs ". You can copy it to new configuration "
  589.            "directory.")))))
  590.  (procedure 
  591.   note-additional
  592.   (message
  593.    "Your old AmiTCP/IP configuration files were copied from an old installation "
  594.    "to the new. However, if you, or any of your installed programs, "
  595.    "have added additional configuration files (in db/) or programs (in bin/), "
  596.    "you need to transfer these to the new "
  597.    "installation manually.\n")
  598.   )
  599.  (transcript "Ready to copy old configuration.")
  600.  (if (askbool
  601.       (default 1)
  602.       (prompt
  603.        "\nDo you want to use settings from an earlier installation?")
  604.       (help
  605.        "    Installer have detected existing configuration "
  606.        "directory \"" old-conf-dir "\" which "
  607.        "can be used to configure the " app-name ". You can keep most "
  608.        "of your previous configuration. This is important if you have "
  609.        "installed extra applications.\n"
  610.        "    Configuration files will be "
  611.        (if (> @user-level 1) 
  612.        "optionally")
  613.        " copied.\n"))
  614.      (
  615.       (copy-rest-config)
  616.       (copy-motd)
  617.       (update-hosts)
  618.       (update-services)
  619.       (update-napsaprefs)
  620.       (note-additional)
  621.       0) ;; FALSE if AmiTCP needs to be reconfigured
  622.    0))
  623.  
  624. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  625. (procedure
  626.  install-napsaterm
  627.  ;;
  628.  ;; Install Napsaterm fonts
  629.  ;;
  630.  ;; Ask for directory to install fonts.
  631.  (procedure
  632.   ask-napsa-font-dir
  633.   (askdir
  634.    (prompt "Select directory where to install Napsaterm fonts.\n")
  635.    (help "    Here you can specify location where to install "
  636.      "the Napsaterm font called `napsa'. "
  637.      "This directory should be in your font path "
  638.      "(i.e. some directory in the assign fonts:).")
  639.    (newpath)
  640.    (default "fonts:")))
  641.  
  642.  (set 
  643.   unpkt-source NapsaFonts-pkt-file
  644.   unpkt-destination (ask-napsa-font-dir)
  645.   unpkt-sdp 1
  646.   unpkt-title-name "NapsaTerm fonts"
  647.   unpkt-title-not "NapsaTerm special fonts"
  648.   )
  649.  (run-unpkt)
  650.  )
  651.  
  652. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  653.  
  654. (procedure
  655.  ;;
  656.  ;; Install passwd and group databases
  657.  ;;
  658.  install-user-databases
  659.  (transcript "Installing user databases")
  660.  (procedure get-mufs-version
  661.         (set mufs-vernum (getversion "multiuser.library" (resident)))
  662.         (set mufs-ver (/ mufs-vernum 65536))
  663.         (set mufs-rev (- mufs-vernum (* ver 65536))))
  664.  (procedure passwd-create
  665.         (copyfiles
  666.          (prompt "Copying " passwd-source " to AmiTCP:db/passwd.")
  667.          (source passwd-source)
  668.          (dest conf-dir)
  669.          (newname "passwd")
  670.          (optional "nofail")))
  671.  (procedure group-create
  672.         (copyfiles
  673.          (prompt "Copying " group-source " to AmiTCP:db/group.")
  674.          (source group-source)
  675.          (dest conf-dir)
  676.          (newname "group")
  677.          (optional "nofail")))
  678.        
  679.  (set passwd-source (tackon conf-dir "passwd-example"))
  680.  (set group-source (tackon conf-dir "group-example"))
  681.  (if (>= @user-level 2)
  682.      (message 
  683.       "\n"
  684.       "Copying user database from file"
  685.       "\n\n\"" passwd-source "\"\n\n"
  686.       "and group database from file"
  687.       "\n\n\"" group-source "\"\n\n"))
  688.  (passwd-create)
  689.  (group-create)
  690.  )
  691.  
  692. (procedure 
  693.  set-must-reboot
  694.  (if (<> (getversion "netinf<o.device" (resident)) 0)
  695.      ((set netinfo-temp-file "t:netinfo-expunge-script")
  696.       (textfile (dest netinfo-temp-file)
  697.         (append (cat 
  698.              "failat 5000\n"
  699.              "avail flush >nil:\n"
  700.              "avail flush >nil:\n"))
  701.         (safe))
  702.       (execute netinfo-temp-file)))
  703.  (set netinfo-version (getversion "netinfo.device" (resident)))
  704.  (if (AND (<> netinfo-version 0)    ; exists
  705.       (< netinfo-version 4))    ; and is old
  706.      ((set must-reboot-after-install 1)
  707.       (message "You seem to have some parts of an old " @app-name 
  708.            " installation running.  Because of this the user "
  709.            "database updating will have no effect before you reboot "
  710.            "your Amiga.\n\n"
  711.            "For this reason you _must_ reboot after the installation "
  712.            "and before the \"Config AmiTCP\" is run."))))
  713.  
  714. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  715. ;;;
  716. ;;; Ask which parts to install
  717. ;;;
  718. ;;; on return following variables will have boolean values:
  719. ;;;
  720. ;;;  do-install-amitcp
  721. ;;;  do-install-drivers
  722. ;;;  do-install-napsafonts
  723. ;;;
  724. (procedure
  725.  ask-install-options
  726.  (set 
  727.   install-options-bitmap
  728.   (askoptions
  729.    (prompt "Select parts to install:\n\n"
  730.        "See the help for explanation on each item.")
  731.    (choices "AmiTCP/IP"
  732.         "Updated Sana-II network drivers"
  733.         "NapsaTerm fonts"
  734.         )
  735.    (default %111)
  736.    (help "    AmiTCP/IP: "
  737.      "The AmiTCP/IP itself. This includes binaries, documentation, "
  738.      "help files and example configuration files.\n"
  739.      "    Updated Sana-II network drivers: "
  740.      "If this option is checked, the Sana-II drivers in Devs:Networks "
  741.      "will be updated. You will be asked for confirmation for each driver.\n"
  742.      "    NapsaTerm fonts: "
  743.      "NapsaTerm has special fonts, that are sized 6×11 pixels and contain "
  744.      "some special VT102 characters. They are suitable for interlaced "
  745.      "screens. If you have normal NTSC or PAL screen, it might be better "
  746.      "to not install these fonts but use Topaz/8 instead.\n"
  747.      ))
  748.   do-install-amitcp (in install-options-bitmap 0)
  749.   do-install-drivers (in install-options-bitmap 1)
  750.   do-install-napsafonts (in install-options-bitmap 2)
  751.   ))
  752.  
  753.  
  754. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  755. ;;;
  756. ;;; Install AmiTCP/IP
  757. ;;;
  758. (procedure 
  759.  install-amitcp
  760.  (select-destination-directory)
  761.  (if (copy-files-to-destination) ; copy AmiTCP/IP files
  762.      (
  763.       ;; update user-startup
  764.       (set uus::commands (cat "assign " atcp-assign " \"" atcp-dest "\"\n"
  765.                   "path " bin-dir " add\n"
  766.                   apipe-mount)
  767.        uus::section @app-name
  768.        uus::file (tackon atcp-assign "addition-to-user-startup"))
  769.       (update-user-startup))
  770.    ))
  771.  
  772. ;;; copy "UnPkt" to RAM: if available
  773. ;;
  774. ;; If UnPkt is not found, then we are not started from the installation disk
  775. ;;
  776. ;;;
  777. (procedure
  778.  set-unpkt-cmd
  779.  (set unpkt-cmd
  780.       (if (exists UnPkt-file)
  781.       ((copyfiles
  782.         (prompt "Copying packet dearchiver to RAM:")
  783.         (source UnPkt-file)
  784.         (dest   "RAM:")
  785.         (safe)
  786.         (optional "nofail"))
  787. ;       "echo")
  788.        "RAM:UnPkt")
  789.     "")))
  790.  
  791. ;;;;;
  792. ;;
  793. ;; Launch Config AmiTCP
  794. ;;
  795. (procedure
  796.   run-config-amitcp
  797.   (set start-config-script "t:start-config-script")
  798.   (textfile 
  799.    (dest start-config-script)
  800.    (append
  801.     ".key foo\n.bra {\n.ket }\n\n"
  802.     "cd " atcp-assign "\n"
  803.     "Stack 20000 ; Installer needs this\n"
  804.     (tackon bin-dir "Installer")
  805.     " SCRIPT \"Config AmiTCP\" APPNAME \"AmiTCP/IP\" LOGFILE config_log_file MINUSER AVERAGE\n"
  806.     )
  807.    (safe))
  808.   (protect start-config-script "+s +e")
  809.   (if (askbool
  810.        (prompt "\nStart \"Config AmiTCP\" to configure the just "
  811.            "installed " @app-name "?")
  812.        (help @app-name " should be configured after the installation. "
  813.          "If you do not want to do the configuration now, you must "
  814.          "do it later by starting the \"Config AmiTCP\" from the "
  815.          "WorkBench icon.\n"))
  816.       (execute start-config-script)))
  817.  
  818. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  819. ;;;
  820. ;;; Installatation sequence
  821. ;;;
  822.  
  823. ;;
  824. ;; Initialize "global" variables to default values (not complete)
  825. ;;
  826. (set
  827.  startup-changed 0
  828.  must-reboot-after-install 0
  829.  )
  830.  
  831. (complete 00) (transcript "On making " app-name ".")
  832. (complete 01) (check-user-level)
  833. (complete 02) (check-system-version)
  834. (complete 03) (check-available-memory)
  835. (complete 04) (check-old-assign)
  836. (complete 05) (check-cpu-type)
  837.  
  838. ;; askdisk for the install-disk1-name?? maybe later...
  839.  
  840. ;; show the README-FIRST file if it exists
  841. (if (exists README-FIRST-file)
  842.     ((run (cat "run " pager-cmd " \"" README-FIRST-file "\" ") (safe))
  843.      (message "    Please read the shown \"Read Me First\" file carefully "
  844.           "before continuing the installation.")))
  845.  
  846.      (set-unpkt-cmd)
  847.      (if (= unpkt-cmd "")
  848.      (abort "    UnPkt command not present on the installation disk!"))
  849.  
  850.      (complete 08) (ask-accept-license)         ;; ask if user accepts the license
  851.      (complete 10) (ask-install-options)
  852.      (complete 15) (if do-install-amitcp (install-amitcp))
  853.      (complete 30) (if do-install-napsafonts (install-napsaterm))
  854.      (complete 35) (if do-install-drivers (update-devices))
  855.      (if do-install-amitcp    ;; Ask if old configuration should be copied
  856.      (
  857.       (set-must-reboot)
  858.       (set old-conf-used 
  859.            (if old-atcp-directory
  860.            (if (exists (tackon old-atcp-directory "bin/startnet") 
  861.                    (noreq))
  862.                ((complete 40)
  863.             (ask-copy-old-configuration)))))
  864.       ;;
  865.       ;; Install user databases if not copied from an old configuration
  866.       ;;
  867.       (if (exists (tackon conf-dir "passwd"))
  868.           (transcript "There is already a user database.")
  869.         ((complete 70)
  870.          (install-user-databases))) ; install passwd/group
  871.       ;;
  872.       ;; Configure AmiTCP/IP is necessary
  873.       ;;
  874.       (complete 90)
  875.       (if (AND (NOT must-reboot-after-install) (NOT old-conf-used))
  876.           ;;
  877.           ;; Spawn the installer on the "Config AmiTCP" with 
  878.           ;; correct options
  879.           (run-config-amitcp)
  880.           ;(configure-amitcp)
  881.         )
  882.       ))
  883.      ;; show something
  884.      (foreach atcp-assign "#?.readme"
  885.           (run (cat "run " pager-cmd) (tackon atcp-assign @each-name)
  886.            (safe)))
  887.  
  888. ;;; All done!
  889. (complete 100)
  890. (exit (if startup-changed 
  891.       (cat "You should reboot your Amiga to enable the changes made "
  892.            "to system startup files.")
  893.     (cat "You must add the contents of the file(s) \"" 
  894.          "addition-to-user-startup\" to your S:User-Startup and "
  895.          "reboot before you can use " @app-name ".\n"))
  896.       (if must-reboot-after-install
  897.       (cat "\nYou MUST reboot before configuring " @app-name ". Start "
  898.            "\"Config AmiTCP\" from WorkBench after the reboot "
  899.            "to configure your new " @app-name " installation.\n")
  900.     ))
  901.  
  902. ;; EOF
  903. ;;
  904.